package de.hwr.sudokuspielehr.io;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Used to read files.
 * 
 * @author J. Reischauer
 * 
 */
public class Reader {

	/**
	 * Returns a files lines stored in a List of Strings.
	 * 
	 * @param pFile
	 *            the file to read from
	 * @return List of Strings containing the files lines
	 * @throws IOException
	 */
	public static List<String> read(File pFile) throws IOException {
		List<String> result = new ArrayList<String>();
		String currentLine;

		try (BufferedReader br = new BufferedReader(new FileReader(pFile))) {
			while ((currentLine = br.readLine()) != null) {
				result.add(currentLine);
			}
		}

		return result;
	}
}
